﻿using System.Text;

Solution solution = new Solution();
// add your code here for debugging

string CountAndSay(int n)
{
    if (n == 1)
        return "1";

    var last = CountAndSay(n - 1);

    StringBuilder stringBuilder = new StringBuilder();
    var count = 0;
    char c = '\0';
    foreach (var item in last)
    {
        if (item == c)
            count++;
        else
        {
            if (count != 0)
                _ = stringBuilder.Append(count).Append(c);
            count = 1;
            c = item;
        }
    }
    if (count != 0)
        _ = stringBuilder.Append(count).Append(c);
    return stringBuilder.ToString();
}

StringBuilder stringBuilder = new StringBuilder()
    .AppendLine("return n switch").AppendLine("{");
for (int i = 1; i <= 30; i++)
{
    _ = stringBuilder.AppendLine($"{i} => \"{CountAndSay(i)}\",");
}
Console.WriteLine(stringBuilder.ToString());